package com.njts.innerclass;

import java.util.Random;

public class Utils{
    public static char[] getVerifyCode(int digit){
        char[] code = new char[digit];
        Random random = new Random();

        for (int i = 0; i < code.length; i++) {
            int type = random.nextInt(3);
            // 随机生成的字符:Random
            switch (type){
                // 数字
                case 0:
                    code[i]= (char) ('0'+random.nextInt(10));
                    break;
                case 1:
                    //大写字母
                    code[i]= (char) ('A'+random.nextInt(26));
                    break;
                default:
                    //小写字母
                    code[i]= (char) ('a'+random.nextInt(26));
                    break;
            }

        }
        return code;
    }
    public static int getMax(int a,int b){
        return a>b?a:b;
    }
}